import {isFunction} from "../../utils/helpers";
import CustomTabBarHelper from "../../custom-tab-bar/CustomTabBarHelper";

const app = getApp()
Page({
    behaviors:[CustomTabBarHelper],
    data: {
        iPhoneX: app.globalData.iPhoneX,
        firstIndex: 0,
        lists: [
            {name: '菜单', code: '1'},
            {
                name: 'e菜单', code: '2', subs: [
                    {name: '餐桌', code: '21'},
                    {name: '躺椅', code: '22'},
                ]
            },
        ]
    },
    onShow(options) {
        this.initTabBarIndex()
    },
    // 顶部菜单点击
    onHeaderCategoryItemTap(e) {
        const index = e.currentTarget.dataset.index || 0
        this.setData({
            firstIndex: index
        })
    },
    // 左边菜单点击
    onLeftCategoryItemTap(e) {
        const index = e.currentTarget.dataset.index || 0
        this.setData({
            firstIndex: index
        })
    },
    // 右边的菜单点击
    onRightCategoryItemTap(e) {
        console.log(e)
    },
});
